package com.test.mchelepesa.dialog_rice;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.test.mchelepesa.R;

public class TipsDialog_rice extends Dialog {

    private final Runnable onOkRunnable;

    public TipsDialog_rice(@NonNull Context context, Runnable onOkRunnable) {
        super(context);
        this.onOkRunnable = onOkRunnable;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_tips_rice);

        getWindow().setBackgroundDrawableResource(R.color.trans);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

        findViewById(R.id.dialog_tips_tv_ok).setOnClickListener(v -> {
            dismiss();
            if (onOkRunnable!=null) onOkRunnable.run();
        });

        findViewById(R.id.dialog_tips_tv_cancel).setOnClickListener(v -> dismiss());

    }

}
